Embodiments of the present invention relate to data processing, and more particularly relate to techniques for incrementing counters in an efficient manner.
Many network devices (e.g., routers, switches, etc.) maintain counters to perform various operations such as tracking network statistics. Merely by way of example, an Ethernet switch may maintain counters to track the total number of data packets received, the total number of data packets dropped, the total number of bytes forwarded, and the like. These statistics are useful for carrying out performance monitoring, traffic engineering, intrusion detection, and other network management functions.
Since the counters in network devices typically track statistics related to incoming data packets, these counters must generally be incremented at a rate proportional to line speed. For example, if data packets arrive at a rate of R Gigabits per second (Gbps), if the minimum size of a data packet is P bits, and if C counters are incremented per data packet, at most RC/P billion counters must be incremented per second. To support this type of speed, many network devices include logic circuits (hereinafter referred to as counter logic circuits) dedicated to incrementing counters in hardware.
While existing counter logic circuits have provided adequate performance for incrementing statistics counters in low bandwidth network devices, the speeds of these existing circuits have become a bottleneck in high bandwidth devices that support emerging data transmissions standards such as OC786, 40 G (i.e., 40 Gbps) Ethernet, and 100 G (i.e., 100 Gbps) Ethernet. In particular, the design of these existing circuits generally requires certain operations to be performed in a single clock cycle, thereby limiting their maximum operating frequency. This, in turn, makes it very difficult (or impossible) to achieve the counter update performance necessary to support line speeds of 40 Gbps, 100 Gbps, and beyond.
Accordingly, it would be desirable to have improved counter logic circuits that can operate at higher frequencies than existing designs.